<template>
    <div>
<h3>用户登录</h3>
<table class="table table-bordered">
    <tbody>
        <tr>
            <td>用户名称</td>
            <td>
                <input type="text" v-model="queryInfo.UserName"/>
            </td>
        </tr>
        <tr>
            <td>用户密码</td>
            <td>
                <input type="password" v-model="queryInfo.Password"/>
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" value="登录" class="btn btn-primary" @click="Log"/>
            </td>
            <td></td>
        </tr>
    </tbody>
</table>
    </div>
</template>

<script setup lang="ts">
import { ref,reactive,onMounted } from 'vue';
import { useRoute,useRouter } from 'vue-router';
import moment from 'moment';
import axios from 'axios';
const Router=useRouter();
const Route=useRoute();
let queryInfo=reactive({
    UserName:'',
    Password:''
})
const Log=()=>{
    axios({
        url:'/api/User/UserLog',
        method:'get',
        params:queryInfo
    })
    .then((res)=>{
        console.log(res.data)
        if(res.data==-2){
            alert("找不到该用户！")
        }
        if(res.data==-1){
            alert("密码错误！")
        }
        if(res.data==1){
            alert("登录成功！")
        }
    })
    .catch((err)=>{
        console.log(err)
    })
}
</script>

<style scoped>

</style>